package com.qing.library_manager.common.Exception.assertion;

import com.qing.library_manager.common.Exception.BaseException;
import com.qing.library_manager.common.Exception.BusinessException;
import com.qing.library_manager.common.constant.IResponseEnum;

import java.text.MessageFormat;

/**
 * <p>TODO</p>
 *
 * @author Yjx
 * @version 1.0.0
 * @since 2022/3/25
 **/
public interface BusinessExceptionAssert extends IResponseEnum, Assert {
    @Override
    default BaseException newException(Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg);
    }
    
    @Override
    default BaseException newException(Throwable t, Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg);
    }
}
